  <template>
  <div class="mynews">
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="date" label="日期" width="180"> </el-table-column>
      <el-table-column prop="title" label="小区详情" width="380">
      </el-table-column>
      <el-table-column prop="from" label="来源"> </el-table-column>
      <el-table-column prop="imgSrc" label="图片">
        <template slot-scope="scope">
          <el-image
            :src="'http://120.48.109.174:8081' + scope.row.imgSrc"
          ></el-image>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

  <script>
export default {
  data() {
    return {
      tableData: [
        {
          date: "2016-05-02",
          name: "狗蛋",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
      ],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      // this.axios.get("http://120.48.109.174:8081/home/news?area=AREA%7C88cff55c-aaa4-e2e0").then(res=>{
      //     console.log(res);
      //     let list = res.data.body;
      //     this.tableData = list;
      // })

    //不使用箭头函数
      var that = this;
      this.axios
        .get("http://120.48.109.174:8081/home/news?area=AREA%7C88cff55c-aaa4-e2e0")
        .then(function (response) {
            let list = response.data.body;
            that.tableData = list;
        })
        .catch(function (error) {
          console.log(error);
        });
    },
  },
};
</script>
<style scoped>
.mynews >>> img {
  border: 2px solid red;
  width: 200px;
}
</style>